<?php

Raise::load('core.text.RaiseInflector');

/**
 * TestCoreRaiseInflector
 * Testing unit of 'phpraise/core/RaiseInflector.php'
 * 
 * @author Sam-Mauris Yong / hellclanner at live dot com
 * @license http://www.opensource.org/licenses/bsd-license New BSD License
 * @package Raise.UnitTest.Test
 */
class TestCoreRaiseInflector extends RaiseTest {

    public static function testClass(){
        self::assertClassExists('RaiseInflector');
        self::assertClassExtends('RaiseInflector', 'RaiseStaticClass');
    }

    public static function testConvertToPlural(){
        self::assertStrictEqual(RaiseInflector::plural('girl'), 'girls');
        self::assertStrictEqual(RaiseInflector::plural('boy'), 'boys');
        self::assertStrictEqual(RaiseInflector::plural('Bearing'), 'Bearings');
        self::assertStrictEqual(RaiseInflector::plural('maze'), 'mazes');
        self::assertStrictEqual(RaiseInflector::plural('fish'), 'fishes');
        self::assertStrictEqual(RaiseInflector::plural('MONKEY'), 'MONKEYS');
        self::assertStrictEqual(RaiseInflector::plural('criterion'), 'criteria');
        self::assertStrictEqual(RaiseInflector::plural('Cactus'), 'Cacti');
        self::assertStrictEqual(RaiseInflector::plural('man'), 'men');
    }

    public static function testConvertToSingular(){
        self::assertStrictEqual(RaiseInflector::singular('girls'), 'girl');
        self::assertStrictEqual(RaiseInflector::singular('Boys'), 'Boy');
        self::assertStrictEqual(RaiseInflector::singular('bearings'), 'bearing');
        self::assertStrictEqual(RaiseInflector::singular('MAZES'), 'MAZE');
        self::assertStrictEqual(RaiseInflector::singular('fishes'), 'fish');
        self::assertStrictEqual(RaiseInflector::singular('monkeys'), 'monkey');
        self::assertStrictEqual(RaiseInflector::singular('criteria'), 'criterion');
        self::assertStrictEqual(RaiseInflector::singular('cacti'), 'cactus');
        self::assertStrictEqual(RaiseInflector::singular('MEN'), 'MAN');
    }

    public static function testCases(){
        self::assertTrue(RaiseInflector::isCapitalLetterWord('Raise'));
        self::assertFalse(RaiseInflector::isCapitalLetterWord('phpRaise'));
        self::assertTrue(RaiseInflector::isCapitalLetterWord('Help'));
        self::assertFalse(RaiseInflector::isCapitalLetterWord('help'));

        self::assertTrue(RaiseInflector::isWordUpperCase('HELP'));
        self::assertFalse(RaiseInflector::isWordUpperCase('HeLP'));
        self::assertFalse(RaiseInflector::isWordUpperCase('help'));

        self::assertFalse(RaiseInflector::isWordLowerCase('HELP'));
        self::assertFalse(RaiseInflector::isWordLowerCase('HeLP'));
        self::assertTrue(RaiseInflector::isWordLowerCase('help'));
    }

}
